package com.dosen.api.third.party.register.param;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2022/5/31 16:51
 * @description:
 */
@NoArgsConstructor
@Data
public class ArgoAppCreateAutoDTO {
    /**
     * apiVersion
     */
    @JSONField(name = "apiVersion")
    public String apiVersion;
    /**
     * kind
     */
    @JSONField(name = "kind")
    public String kind;
    /**
     * metadata
     */
    @JSONField(name = "metadata")
    public MetadataDTO metadata;
    /**
     * spec
     */
    @JSONField(name = "spec")
    public SpecDTO spec;

    /**
     * MetadataDTO
     */
    @NoArgsConstructor
    @Data
    public static class MetadataDTO {
        /**
         * name
         */
        @JSONField(name = "name")
        public String name;
    }

    /**
     * SpecDTO
     */
    @NoArgsConstructor
    @Data
    public static class SpecDTO {
        /**
         * destination
         */
        @JSONField(name = "destination")
        public DestinationDTO destination;
        /**
         * source
         */
        @JSONField(name = "source")
        public SourceDTO source;
        /**
         * project
         */
        @JSONField(name = "project")
        public String project;
        /**
         * syncPolicy
         */
        @JSONField(name = "syncPolicy")
        public SyncPolicyDTO syncPolicy;

        /**
         * DestinationDTO
         */
        @NoArgsConstructor
        @Data
        public static class DestinationDTO {
            /**
             * name
             */
            @JSONField(name = "name")
            public String name;
            /**
             * namespace
             */
            @JSONField(name = "namespace")
            public String namespace;
            /**
             * server
             */
            @JSONField(name = "server")
            public String server;
        }

        /**
         * SourceDTO
         */
        @NoArgsConstructor
        @Data
        public static class SourceDTO {
            /**
             * path
             */
            @JSONField(name = "path")
            public String path;
            /**
             * repoURL
             */
            @JSONField(name = "repoURL")
            public String repoURL;
            /**
             * targetRevision
             */
            @JSONField(name = "targetRevision")
            public String targetRevision;
        }

        /**
         * SyncPolicyDTO
         */
        @NoArgsConstructor
        @Data
        public static class SyncPolicyDTO {
            /**
             * automated
             */
            @JSONField(name = "automated")
            public AutomatedDTO automated;
            /**
             * syncOptions
             */
            @JSONField(name = "syncOptions")
            public List<String> syncOptions;

            /**
             * AutomatedDTO
             */
            @NoArgsConstructor
            @Data
            public static class AutomatedDTO {
                /**
                 * prune
                 */
                @JSONField(name = "prune")
                public Boolean prune;
                /**
                 * selfHeal
                 */
                @JSONField(name = "selfHeal")
                public Boolean selfHeal;
            }
        }
    }
}

